'''
@Author: hua
@Date: 2018-08-30 10:52:23
@LastEditors  : hua
@LastEditTime : 2019-12-18 14:13:46
'''
from app import app
from app.Controllers.BaseController import BaseController
from app.Vendor.Utils import Utils
from app.Models.Users import Users
from app.Models.Suggest import Suggest
from app.Models.Comments import Comments
from app.Models.ImgShard import ImgShard
from app.Service.TableService import TableService
from app.Models.Log import Log
from app.Vendor.UsersAuthJWT import UsersAuthJWT
from app.Vendor.Decorator import validator
from flask import request
from werkzeug.utils import secure_filename
from kafka import KafkaProducer
import os, base64,json

@app.route('/financial_pro',methods=['GET','POST'])
def financial_pro():
    if request.method == 'POST':
        data = request.form
        producer = KafkaProducer(bootstrap_servers=['192.168.30.120:9092'],value_serializer=lambda v: json.dumps(v).encode("utf-8"))
        response = producer.send('financial_pro',data)
        producer.flush()
        print(response)
        return BaseController().successData(data)
    else:
        return BaseController().error('发送失败')